//index.js
//获取应用实例
var app = getApp()
Page({
    data: {
        content: '',
        title: ''
    },

    setTitle:function (e) {
        this.setData({
            title: e.detail.value
        });
    },
    setContent:function (e) {
        this.setData({
            content: e.detail.value
        });
    },

    sendFk: function () {
        let _content = this.data.content;
        let _title = this.data.title;

        if (!_title) {
            wx.showModal({
                title: '提示',
                content: '请输入您的标题',
                showCancel: false
            });
            return;
        }

        if (!_content) {
            wx.showModal({
                title: '提示',
                content: '请输入您的内容',
                showCancel: false
            });
            return;
        }
        wx.showLoading({
            title: '请稍候...',
            mask: true
        });

        wx.request({
            url: 'https://mb.800151.com/phalapi/Public/applet/?service=Demo.demoAdd',
            data: {
                'title': _title,
                'content': _content
            },
            header: {
                'content-type': 'application/json'
            },
            success: function (res) {
                wx.hideLoading();
                wx.showToast({
                    title: '成功',
                    icon: 'success',
                    duration: 1000
                });
            }
        })
    },
    showRet:function (e) {
        wx.navigateTo({
            url: '../demo/index'
        })
    },
    sxClick:function (e) {
        wx.navigateTo({
            url: '../add/index'
        })
    },
    indexClick:function (e) {
        wx.navigateTo({
            url: '../index/index'
        })
    },
    onLoad: function () {
        // console.log('onLoad')
        var that = this

    },
})
